/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package library;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author mr2
 */
public class StatusSidang {
    
    Connection koneksi;
    
    String statusProposal;
    String statusProgress;
    String statusFinal;

    public String getStatusProposal() {
        return statusProposal;
    }

    public void setStatusProposal(String statusProposal) {
        this.statusProposal = statusProposal;
    }

    public String getStatusProgress() {
        return statusProgress;
    }

    public void setStatusProgress(String statusProgress) {
        this.statusProgress = statusProgress;
    }

    public String getStatusFinal() {
        return statusFinal;
    }

    public void setStatusFinal(String statusFinal) {
        this.statusFinal = statusFinal;
    }
    
    public StatusSidang(){
        koneksi = Koneksi.getKoneksi();
    }
    
    public List<StatusSidang> StatusSidangProposal(){
        
        PreparedStatement prepare = null;
        ResultSet result = null;
        ArrayList<StatusSidang> listStatusProposal = new ArrayList<StatusSidang>();
        
        try{
            String sql = "SELECT * FROM status_sidang_proposal";
            
            prepare = koneksi.prepareStatement(sql);
            
            result = prepare.executeQuery();
            
            while(result.next()){
                /*StatusKoorTA statuskoorTA = new StatusKoorTA();
                statuskoorTA.setStatusKoorTA(result.getString("status"));*/
                StatusSidang Proposal = new StatusSidang();
                Proposal.setStatusProposal(result.getString("status_sidang_proposal"));
                
                listStatusProposal.add(Proposal);
            }
            return listStatusProposal;
            
        }catch(SQLException ex){
            System.out.print(ex.getMessage());
            return listStatusProposal;            
        }finally{
            if(prepare != null){
                try{
                    prepare.close();
                }catch(SQLException ex){
                    
                }
            }
            if(result != null){
                try{
                    result.close();
                }catch(SQLException ex){
                    
                }
            }
        }
    }
    
    public List<StatusSidang> StatusSidangProgress(){
        
        PreparedStatement prepare = null;
        ResultSet result = null;
        ArrayList<StatusSidang> listStatusProgress = new ArrayList<StatusSidang>();
        
        try{
            String sql = "SELECT * FROM status_sidang_progress";
            
            prepare = koneksi.prepareStatement(sql);
            
            result = prepare.executeQuery();
            
            while(result.next()){
                /*StatusKoorTA statuskoorTA = new StatusKoorTA();
                statuskoorTA.setStatusKoorTA(result.getString("status"));*/
                StatusSidang Progress = new StatusSidang();
                Progress.setStatusProgress(result.getString("status_sidang_progress"));
                
                listStatusProgress.add(Progress);
            }
            return listStatusProgress;
            
        }catch(SQLException ex){
            System.out.print(ex.getMessage());
            return listStatusProgress;            
        }finally{
            if(prepare != null){
                try{
                    prepare.close();
                }catch(SQLException ex){
                    
                }
            }
            if(result != null){
                try{
                    result.close();
                }catch(SQLException ex){
                    
                }
            }
        } 
    }
    
    public List<StatusSidang> StatusSidangFinal(){
        
        PreparedStatement prepare = null;
        ResultSet result = null;
        ArrayList<StatusSidang> listStatusFinal = new ArrayList<StatusSidang>();
        
        try{
            String sql = "SELECT * FROM status_sidang_final";
            
            prepare = koneksi.prepareStatement(sql);
            
            result = prepare.executeQuery();
            
            while(result.next()){
                /*StatusKoorTA statuskoorTA = new StatusKoorTA();
                statuskoorTA.setStatusKoorTA(result.getString("status"));*/
                StatusSidang Final = new StatusSidang();
                Final.setStatusFinal(result.getString("status_sidang_final"));
                
                listStatusFinal.add(Final);
            }
            return listStatusFinal;
            
        }catch(SQLException ex){
            System.out.print(ex.getMessage());
            return listStatusFinal;            
        }finally{
            if(prepare != null){
                try{
                    prepare.close();
                }catch(SQLException ex){
                    
                }
            }
            if(result != null){
                try{
                    result.close();
                }catch(SQLException ex){
                    
                }
            }
        }
    }
}
